{extend name="common@admin_base" /}

{block name="body"}
<div class="layui-row">
    <div class="layui-col-md4 layui-col-md-offset1">
        <div class="layui-col-md4">
            <img src="{$user.headimg}" alt="用户头像"style="width: 80px;">
        </div>
        <div class="layui-col-md8 layui-form layui-form-pane">
            <div class="layui-form-item">
                <label for="nickname" class="layui-form-label">用户昵称</label>
                <div class="layui-input-block">
                    <span id="nickname" class="layui-input">{$user.nickname}</span>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="email" class="layui-form-label">邮箱</label>
                <div class=" layui-input-block">
                    <span id="email" class="layui-input">{$user.email}</span>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="username" class="layui-form-label">用户名</label>
                <div class=" layui-input-block">
                    <span id="username" class="layui-input"><?php echo substr($user->username,0,3)."****".substr($user->username,-4); ?></span>
                </div>
            </div>
        </div>
    </div>
    <div class="layui-col-md7">
        <div class="layui-form layui-form-pane">
            <div class="layui-form-item">
                <label for="trueName" class="layui-form-label">真实姓名</label>
                <div class=" layui-input-block">
                    <span id="trueName" class="layui-input">{$user.trueName}</span>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="idCardNo" class="layui-form-label">身份证号</label>
                <div class="layui-input-block">
                    <span id="idCardNo" class="layui-input"><?php echo substr($user->idCardNo,0,3)."******".substr($user->idCardNo,-4); ?></span>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="groupId" class="layui-form-label">用户组</label>
                <div class="layui-input-block">
                    <span id="groupId" class="layui-input">{$user.userGroup.groupName}</span>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="layui-row">
    <fieldset class="layui-elem-field">
        <legend>个性签名<a id="updatePS" data-method="notice" data-type="auto" ><span class="layui-icon layui-icon-edit"></span></a></legend>
        <div class="layui-field-box" id="userps">
            {$user.personalitySignature}
        </div>
    </fieldset>
</div>
{/block}

{block name="head_extends"}
<script src="/static/js/base.js"></script>
<script>
    $(function () {
        //个性签名
        var ps = $("#updatePS");
        var lay = parent.layui;
        lay.use('layer', function(){
            var active = {
                notice: function(){
                    var laye = parent.layer;
                    var psDIV = $("#userps");
                    //示范一个公告层
                    laye.open({
                        type: 1
                        ,title: '个性签名' //不显示标题栏
                        ,closeBtn: true
                        ,area: ['390px', '260px']
                        ,shade: 0.8
                        ,id: 'ps' //设定一个id，防止重复弹出
                        ,btn: ['确认修改', '取消']
                        ,btnAlign: 'c'
                        ,moveType: 1 //拖拽模式，0或者1
                        ,content: '<div>\n' +
                        '    <form action="" method="post">\n' +
                        '        <textarea name="personalitySignature" id="personalitySignature" cols="30" rows="10" class="layui-textarea">'+psDIV.html()+'</textarea>\n' +
                        '    </form>\n' +
                        '</div>'
                        ,yes:function (index,layero) {
                            var psDOM = layero.find('#personalitySignature');
                            j_ajax('{$_form.admin_user_updatePersonInfo}',{
                                ps:psDOM.val()
                            },function (d) {
                                laye.msg(d.info);
                                var userps = $("#userps");
                                userps.empty();
                                userps.html(psDOM.val());
                                laye.close(index);
                            },function (a,b,c) {
                                laye.msg(c);
                            });
                        }
                    });
                }
            };

            //更新个性签名
            ps.on('click',function () {
                var othis = $(this), method = othis.data('method');
                active[method] ? active[method].call(this, othis) : '';
            });
        });

    });
</script>
{/block}